var axios;
try {
  axios = require("axios");
} catch (e) {
  axios = require("axios/dist/node/axios.cjs");
}

const request = axios.create({
  timeout: 10000,
  headers: {
    "user-agent":
      "Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
  },
});

let errorCallback = (error) => {
  return Promise.reject(error);
};

request.interceptors.request.use(function (config) {
  return config;
}, errorCallback);

request.interceptors.response.use(function (res) {
  return res.data;
}, errorCallback);

module.exports = request;
